import {request} from "@/service/request";
import Pageable = Api.Common.Pageable;
import Page = Api.Common.Page;

export function fetchSaveRole(params: Api.Entity.Role) {
  return request<Api.Entity.Role>({
    url: '/role/save',
    method: 'post',
    data: params
  });
}

export function fetchDeleteRole(ids: number[]) {
  return request<Api.Entity.Role>({
    url: '/role/delete',
    method: 'post',
    data: {
      ids: ids
    }
  });
}

export function fetchUpdateRole(params: Api.Entity.Role) {
  return request<Api.Entity.Role>({
    url: '/role/update',
    method: 'post',
    data: params
  });
}

/** 角色分页查询 */
export function fetchGetRoleList(params?: Pageable) {
  return request<Page<Api.Entity.Role>>({
    url: '/role/getRoleList',
    method: 'post',
    data: params
  });
}

/**
 * 查询所有角色
 */
export function fetchGetAllRoles() {
  return request<Api.Entity.Role[]>({
    url: '/role/getAllRoles',
    method: 'post'
  });
}
